//
//  DZOtherHead.h
//  dzyc
//
//  Created by 蓝鳍互娱 on 2024/6/11.
//

#ifndef DZOtherHead_h
#define DZOtherHead_h

#define DZScreen_W [UIScreen mainScreen].bounds.size.width
#define DZScreen_H [UIScreen mainScreen].bounds.size.height
#define DZRatio(W) DZScreen_W * W / 750
#define DZTabBarH (DZIsiPhoneX ? 83 : 49)
#define DZTopSafe_H (DZIsiPhoneX ? 44 : DZState_H)
#define DZBottomSafe_H (DZIsiPhoneX ? 34 : 0)
#define DZNavBar_H 44.0
#define DZState_H [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager.statusBarFrame.size.height
#define DZNav_H (DZState_H + DZNavBar_H)
#define DZWeakSelf  __weak __typeof__(self) weakSelf = self;


#define DZIsiPhoneX \
({BOOL DZIsiPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
DZIsiPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(DZIsiPhoneX);})

#define DZImageNamed(x) [UIImage imageNamed:x]

#define DZHex(__hex) DZHexA(__hex, 1.0)
#define DZHexA(__hex, __a) ({unsigned rgbValue = 0; \
NSString *hexString = [__hex stringByReplacingOccurrencesOfString:@"#" withString:@""]; \
[[NSScanner scannerWithString:hexString] scanHexInt:&rgbValue]; \
[UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:__a];})

#endif /* DZOtherHead_h */
